package com.AO.DAO;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * Food entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "food", catalog = "delicacy")
public class Food implements java.io.Serializable {

	// Fields

	private String foodId;
	private String zan;
	private User user;
	private String foodName;
	private Timestamp createDatetime;
	private String img;
	private String description;
	private String ps;
	private String evaluation;
	private FoodRecommendedDaily foodRecommendedDaily;
	private Set<FoodPracticeSteps> foodPracticeStepses = new HashSet<FoodPracticeSteps>(
			0);
	private Set<FoodFoodMenuRelation> foodFoodMenuRelations = new HashSet<FoodFoodMenuRelation>(
			0);
	private Set<FoodMaterialFoodRelation> foodMaterialFoodRelations = new HashSet<FoodMaterialFoodRelation>(
			0);
	private Set<FoodFoodTypesRelation> foodFoodTypesRelations = new HashSet<FoodFoodTypesRelation>(
			0);

	// Constructors

	/** default constructor */
	public Food() {
	}

	/** minimal constructor */
	public Food(String foodId, User user, String foodName, String evaluation) {
		this.foodId = foodId;
		this.user = user;
		this.foodName = foodName;
		this.evaluation = evaluation;
	}

	/** full constructor */
	public Food(String foodId, User user, String foodName,
			Timestamp createDatetime, String img, String description,
			String ps, String evaluation,
			FoodRecommendedDaily foodRecommendedDaily,
			Set<FoodPracticeSteps> foodPracticeStepses,
			Set<FoodFoodMenuRelation> foodFoodMenuRelations,
			Set<FoodMaterialFoodRelation> foodMaterialFoodRelations,
			Set<FoodFoodTypesRelation> foodFoodTypesRelations) {
		this.foodId = foodId;
		this.user = user;
		this.foodName = foodName;
		this.createDatetime = createDatetime;
		this.img = img;
		this.description = description;
		this.ps = ps;
		this.evaluation = evaluation;
		this.foodRecommendedDaily = foodRecommendedDaily;
		this.foodPracticeStepses = foodPracticeStepses;
		this.foodFoodMenuRelations = foodFoodMenuRelations;
		this.foodMaterialFoodRelations = foodMaterialFoodRelations;
		this.foodFoodTypesRelations = foodFoodTypesRelations;
	}

	// Property accessors
	@Id
	@Column(name = "food_id", unique = true, nullable = false, length = 50)
	public String getFoodId() {
		return this.foodId;
	}

	public void setFoodId(String foodId) {
		this.foodId = foodId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "upload_user", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "food_name", nullable = false, length = 50)
	public String getFoodName() {
		return this.foodName;
	}

	public void setFoodName(String foodName) {
		this.foodName = foodName;
	}

	@Column(name = "create_datetime", length = 19)
	public Timestamp getCreateDatetime() {
		return this.createDatetime;
	}

	public void setCreateDatetime(Timestamp craeteDatetime) {
		this.createDatetime = craeteDatetime;
	}

	@Column(name = "img")
	public String getImg() {
		return this.img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	@Column(name = "description")
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "ps")
	public String getPs() {
		return this.ps;
	}

	public void setPs(String ps) {
		this.ps = ps;
	}

	@Column(name = "evaluation", nullable = false)
	public String getEvaluation() {
		return this.evaluation;
	}

	public void setEvaluation(String evaluation) {
		this.evaluation = evaluation;
	}

	@OneToOne(fetch = FetchType.LAZY, mappedBy = "food")
	public FoodRecommendedDaily getFoodRecommendedDaily() {
		return this.foodRecommendedDaily;
	}

	public void setFoodRecommendedDaily(
			FoodRecommendedDaily foodRecommendedDaily) {
		this.foodRecommendedDaily = foodRecommendedDaily;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "food")
	public Set<FoodPracticeSteps> getFoodPracticeStepses() {
		return this.foodPracticeStepses;
	}

	public void setFoodPracticeStepses(
			Set<FoodPracticeSteps> foodPracticeStepses) {
		this.foodPracticeStepses = foodPracticeStepses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "food")
	public Set<FoodFoodMenuRelation> getFoodFoodMenuRelations() {
		return this.foodFoodMenuRelations;
	}

	public void setFoodFoodMenuRelations(
			Set<FoodFoodMenuRelation> foodFoodMenuRelations) {
		this.foodFoodMenuRelations = foodFoodMenuRelations;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "food")
	public Set<FoodMaterialFoodRelation> getFoodMaterialFoodRelations() {
		return this.foodMaterialFoodRelations;
	}

	public void setFoodMaterialFoodRelations(
			Set<FoodMaterialFoodRelation> foodMaterialFoodRelations) {
		this.foodMaterialFoodRelations = foodMaterialFoodRelations;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "food")
	public Set<FoodFoodTypesRelation> getFoodFoodTypesRelations() {
		return this.foodFoodTypesRelations;
	}

	public void setFoodFoodTypesRelations(
			Set<FoodFoodTypesRelation> foodFoodTypesRelations) {
		this.foodFoodTypesRelations = foodFoodTypesRelations;
	}
	
	@Column(name = "zan")
	public String getZan() {
		return zan;
	}

	public void setZan(String zan) {
		this.zan = zan;
	}

}